{if $admin_request eq 'form_fields'}


<div id="browse-records">

<div id="tabs">

<ul>
<li><a href="#tabs-new">{$lang.$base_request.t_addnew}</a></li>
<li><a href="#tabs-existing">{$lang.$base_request.t_view}</a></li>
</li>
</ul>

<div id="tabs-new">

<div id="new-data">
<form action="" onSubmit="return false;" id="newdataform" class="ui-form">

        <ul>
            <li class="ui-widget-header">
                {$lang.$admin_page.$base_request.pn}
            </li>
          <li class="columns on-3">
                <div class="column fixed narrow">
                    <label class="required" for="ff_name">
                        {$lang.$base_request.ff_name}
                    </label>
                </div>
                <div class="column fixed narrow">
                    <input type="text" name="ff_name" id="ff_name" value="" class="required" />
                </div>
                <div class="column elastic third-cell">
                    Information
                </div>
            </li>            

          <li class="columns on-3">
                <div class="column fixed narrow">
                    <label class="required" for="ff_tag">
                        {$lang.$base_request.ff_tag}
                    </label>
                </div>
                <div class="column fixed narrow">
                    <input type="text" name="ff_tag" id="ff_tag" value="" class="required check" data-formid="newdataform" data-id="{$pv.data.id}" />
                    <span class="sprite-icons sprite-blankex" id="check-newdataform-ff_tag"></span>
                </div>
                <div class="column elastic third-cell">
                    Information
                </div>
            </li>
          <li class="columns on-3">
                <div class="column fixed narrow">
                    <label class="" for="ff_required">
                        {$lang.$base_request.ff_required}
                    </label>
                </div>
                <div class="column fixed narrow">
                    <input type="checkbox" name="ff_required" id="ff_required" value="1" class="" />
                </div>
                <div class="column elastic third-cell">
                    Information
                </div>
            </li>            
            
          <li class="columns on-3">
                <div class="column fixed narrow">
                    <label class="required" for="{$admin_request}-ff_type">
                        {$lang.$base_request.ff_type}
                    </label>
                </div>
                <div class="column fixed narrow">
                
                <select id="{$admin_request}-ff_type" name="ff_type" class="chzn-select toggler required" data-related="{$admin_request}-ff_type-related">
                <option value="" selected>{$lang.please_select}</option>
                <option value="text">{$lang.$base_request.ff_type_01}</option>
                <option value="textarea">{$lang.$base_request.ff_type_02}</option>
                <option value="heading">{$lang.$base_request.ff_type_03}</option>
                <option value="checkbox">{$lang.$base_request.ff_type_04}</option>
                <option value="checkboxg" data-extra="1">{$lang.$base_request.ff_type_05}</option>
                <option value="radio" data-extra="1">{$lang.$base_request.ff_type_06}</option>
                <option value="select" data-extra="1">{$lang.$base_request.ff_type_07}</option>
                <option value="uploadp">{$lang.$base_request.ff_type_08}</option>
                <option value="uploadd">{$lang.$base_request.ff_type_09}</option>
                </select>

                </div>
                <div class="column elastic third-cell">
                    Information
                </div>
            </li>
            
          <li class="columns on-3 ui-helper-hidden" id="{$admin_request}-ff_type-related">
                <div class="column fixed narrow">
                    <label class="ff_params" for="ff_params">
                        {$lang.$base_request.ff_params}
                    </label>
                </div>
                <div class="column fixed narrow">
                    <input type="text" name="ff_params" id="ff_params" value="" class="" />
                </div>
                <div class="column elastic third-cell">
                    Information ( Use ";" as delimiter, example: "apples;bananas;oranges")
                </div>
            </li>  
            <li style="padding:0;height:0">
            </li>

                        
        </ul>
        
        <ul class="no-stripes">
            <li class="borderless">
                <label class="display-ib borderless">
                </label>
                <button class="ui-button ui-state-default ui-corner-all form-trigger" data-action="new" data-formid="newdataform">
                    <span class="sprite-icons sprite-add icon-holder"></span>
                    <span>{$lang.forms.add}</span>
                </button>
            </li>
        </ul>

</form>
</div><!-- //new-data -->
</div><!-- //tabs-new -->

<div id="tabs-existing">

<table id="table-{$admin_request}" class="display datatable">
<thead>
<tr>
            <th>
                {$lang.$base_request.ff_name}
            </th>
            <th>
                {$lang.$base_request.ff_tag}
            </th>
                    
            <th>
                {$lang.$base_request.ff_type}
            </th>
            <th>
                {$lang.actions}
            </th>            
            
	</tr>
</thead>

	<tbody>
		<tr>
			<td colspan="3" class="dataTables_empty">Loading data from server</td>
		</tr>
	</tbody>
        
</table>

</div><!-- //tabs-existing -->

</div><!-- //tabs -->



</div><!-- //browse-records -->

<div id="edit-record" class="ui-helper-hidden">

</div><!-- //edit-record -->

{capture "$admin_request"}

_sid ='{$user.session_id}';

$('#tabs').tabs();
$('#ff_type').val("").trigger("liszt:updated");


{literal}

  $('#table-{/literal}{$admin_request}{literal}').dataTable( {
      "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": _urlbegin + '/listing-{/literal}{$admin_request}{literal}/' + _urlend + _ajax,
        
        "aoColumns": [
            { "mDataProp": "ff_name" },
            { "mDataProp": "ff_tag" },
            { "mDataProp": "ff_type" },
            { "mDataProp": "actions","bSortable": false  }
        ],
    "fnServerData": function ( sSource, aoData, fnCallback ) {
      $.ajax( {
      "global": false,
        "dataType": 'json', 
        "type": "GET", 
        "url": sSource, 
        "data": aoData, 
        "success": fnCallback
      }); 
      }        
    } );
    
{/literal}

{/capture}

{/if} {* browse *}



{if $admin_request eq 'edit-form_fields'}
<div id="save-data">
<form action="" onSubmit="return false;" id="savedataform" class="ui-form">
<input type="hidden" id="id" name="id" value="{$pv.data.id}" />
        <ul>
        <li class="columns on-3">
                <div class="column fixed narrow">
                    <label class="required" for="save-ff_name">
                        {$lang.$base_request.ff_name}
                    </label>
                </div>
                <div class="column fixed narrow">
                    <input type="text" name="ff_name" id="save-ff_name" value="{$pv.data.ff_name}" class="required" />
                </div>
                <div class="column elastic third-cell">
                    Information
                </div>
            </li>            

          <li class="columns on-3">
                <div class="column fixed narrow">
                    <label class="required" for="save-ff_tag">
                        {$lang.$base_request.ff_tag}
                    </label>
                </div>
                <div class="column fixed narrow">
                    <input type="text" name="ff_tag" id="save-ff_tag" value="{$pv.data.ff_tag}" class="required check" data-formid="savedataform" data-id="{$pv.data.id}" />
                    <span class="sprite-icons sprite-blankex" id="check-savedataform-ff_tag"></span>
                </div>
                <div class="column elastic third-cell">
                    Information
                </div>
            </li>
          <li class="columns on-3">
                <div class="column fixed narrow">
                    <label class="required" for="save-ff_required">
                        {$lang.$base_request.ff_required}
                    </label>
                </div>
                <div class="column fixed narrow">
                    <input type="checkbox" name="ff_required" id="save-ff_required" value="1" class="required" {if $pv.data.ff_required eq "1"}checked{/if} />
                </div>
                <div class="column elastic third-cell">
                    Information
                </div>
            </li>            
            
          <li class="columns on-3">
                <div class="column fixed narrow">
                    <label class="required" for="{$admin_request}-ff_type">
                        {$lang.$base_request.ff_type}
                    </label>
                </div>
                <div class="column fixed narrow">
                
                <select id="{$admin_request}-ff_type" name="ff_type" class="chzn-select toggler required" data-related="{$admin_request}-ff_type-related">
                <option value="" selected>{$lang.please_select}</option>
                <option value="text">{$lang.$base_request.ff_type_01}</option>
                <option value="textarea">{$lang.$base_request.ff_type_02}</option>
                <option value="heading">{$lang.$base_request.ff_type_03}</option>
                <option value="checkbox">{$lang.$base_request.ff_type_04}</option>
                <option value="checkboxg" data-extra="1">{$lang.$base_request.ff_type_05}</option>
                <option value="radio" data-extra="1">{$lang.$base_request.ff_type_06}</option>
                <option value="select" data-extra="1">{$lang.$base_request.ff_type_07}</option>
                <option value="uploadp">{$lang.$base_request.ff_type_08}</option>
                <option value="uploadd">{$lang.$base_request.ff_type_09}</option>
                </select>

                </div>
                <div class="column elastic third-cell">
                    Information
                </div>
            </li>
            
          <li class="columns on-3 ui-helper-hidden" id="{$admin_request}-ff_type-related">
                <div class="column fixed narrow">
                    <label class="ff_params" for="save-ff_params">
                        {$lang.$base_request.ff_params}
                    </label>
                </div>
                <div class="column fixed narrow">
                    <input type="text" name="ff_params" id="save-ff_params" value="{$pv.data.ff_params}" class="" />
                </div>
                <div class="column elastic third-cell">
                    Information ( Use ";" as delimiter, example: "apples;bananas;oranges")
                </div>
            </li>  
            <li style="padding:0;height:0">
            </li>
            

                        
        </ul>
        <ul class="no-stripes">
            <li class="borderless">
                <label class="display-ib borderless">
                </label>
                <button class="ui-button ui-state-default ui-corner-all form-trigger" data-action="save" data-formid="savedataform">
                    <span class="sprite-icons sprite-save_on icon-holder"></span>
                    <span>{$lang.forms.save}</span>
                </button>&nbsp;&nbsp;&nbsp;
                <button class="ui-button ui-state-default ui-corner-all cancel">
                    <span class="sprite-icons sprite-cross icon-holder"></span>
                    <span>{$lang.forms.cancel_close}</span>
                </button>
            </li>
        </ul>

</form>
</div>

<script type="text/javascript">
$(function()){ldelim}

{include file="_admin/inc/inc_js_edit.tpl"}

$('#save-data .chzn-select').chosen().css('display', '').addClass('ui-helper-hidden-accessible');
console.log($('#{$admin_request}-ff_type'));
$('#{$admin_request}-ff_type').val("{$pv.data.ff_type}").trigger("liszt:updated");
{if $pv.data.ff_params neq ""}
$('#save-data #{$admin_request}-ff_type-related').removeClass('ui-helper-hidden');
{/if}
{literal}
$('#save-data .wysiwyg').elrte({
toolbar: "eldorado"
});

{/literal}
{rdelim});
</script>
{/if} {* edit *}